package db

import (
	"github.com/couchbase/gocb/v2"
	"reflect"
)

const (
	Cb   = 1
	Bolt = 2
)

type CrudOpts struct {
	DbType     int
	Scope      string
	Collection string
	Params     []any
	Sql        string
	Oper       string
	PrimaryKey string
	JsonPK     string
	Err        error
	// 参数
	Args   map[string]any
	Tx     *gocb.TransactionAttemptContext
	TxOpts *gocb.TransactionOptions
	Tip    string
	//DbCtx
}
type FilterParams struct {
	Sql         string
	Params      []any
	Index       int
	TargetObj   string
	Foreign     []reflect.StructField
	DepthFilter map[int]map[string]DepthObjF
	Depth       int
	Joiner      string
	Method      DeeprMethod
	OrFilter    any
	T           any
	TType       reflect.Type
}

type DeeprMethod struct {
	Method  reflect.Method
	EntType reflect.Type
	Entity  reflect.Value
	Has     bool
}

type DepthObjF struct {
	Sql    string
	Parent string
}
